Imports System.Data
Imports System.Data.SqlClient
Public Class oSettle   
    Public Shared Function PaymentAdd(ByVal BILLCODE As Int64, _
                                        ByVal PAY_METHOD As Integer, _
                                        ByVal PAY_AMT As Double, _
                                        ByVal CC_TYPE As String, _
                                        ByVal CUR_CODE As String, _
                                        ByVal EX_RATE As Double, _
                                        ByVal CUS_CODE As String) As Integer
        Try
            Dim arName As New ArrayList
            Dim arVal As New ArrayList
            Dim dt As DataTable
            arName.Clear()
            arName.Add("@BILLCODE")
            arName.Add("@PAY_METHOD")
            arName.Add("@PAY_AMT")
            arName.Add("@CC_TYPE")
            arName.Add("@CUR_CODE")
            arName.Add("@EX_RATE")
            arName.Add("@CUS_CODE")
            arVal.Clear()
            arVal.Add(BILLCODE)
            arVal.Add(PAY_METHOD)
            arVal.Add(PAY_AMT)
            arVal.Add(CC_TYPE)
            arVal.Add(CUR_CODE)
            arVal.Add(EX_RATE)
            arVal.Add(CUS_CODE)
            dt = BLL.ObjectGetBy("Payment_Add", arName, arVal)
            'If dt.Rows.Count > 0 Then
            '    BLL.ReturnXML("PAYMENT", dt)
            'End If
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Function
    
    Public Shared Sub SettleBill(ByVal BILL_AMT As Double, ByVal BILL_TAX_AMT As Double, _
                    ByVal BILL_DCPER As Double, ByVal BILL_DCAMT As Double, _
    ByVal BILL_SVC As Double, ByVal BILL_TOTAL As Double, ByVal ATTRIBUTE As String, ByVal BILL_CODE As Int64)
        Try
            If PublicFunction.OpenSQLConnection() Then
                Dim MyCommand As SqlCommand = New SqlCommand("BILL_SETTLE", PublicVariable.Connection)
                MyCommand.CommandType = CommandType.StoredProcedure
                MyCommand.Parameters.AddWithValue("@BILL_AMT", BILL_AMT)
                MyCommand.Parameters.AddWithValue("@BILL_TAX_AMT", BILL_TAX_AMT)
                MyCommand.Parameters.AddWithValue("@BILL_DCPER", BILL_DCPER)
                MyCommand.Parameters.AddWithValue("@BILL_DCAMT", BILL_DCAMT)
                MyCommand.Parameters.AddWithValue("@BILL_SVC", BILL_SVC)
                MyCommand.Parameters.AddWithValue("@BILL_TOTAL", BILL_TOTAL)
                MyCommand.Parameters.AddWithValue("@ATTRIBUTE", ATTRIBUTE)
                MyCommand.Parameters.AddWithValue("@UPDATEDUSER", PublicVariable.UserCode)
                MyCommand.Parameters.AddWithValue("@BILL_CODE", BILL_CODE)
                Dim ds As New DataSet
                Using da As New SqlDataAdapter()
                    ds.Clear()
                    da.SelectCommand = MyCommand
                    da.Fill(ds)
                End Using
                PublicVariable.Connection.Close()
                'BLL.ReturnXML("BILL", ds.Tables(0))
                'BLL.ReturnXML("BILL_DETAIL", ds.Tables(1))
            End If
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub
    
End Class
